﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ManyConsole;
using NDesk.Options;

namespace Processor
{
   namespace FTRCommands
   {
      public class ListSchedules : ConsoleCommand
      {
         public ListSchedules()
         {
            this.IsCommand("ListSchedules", "List ForTheRecord recording schedules.");
            this.SkipsCommandSummaryBeforeRunning();
         }

         public override int Run(string[] remainingArguments)
         {
            ForTheRecord.FTR f = new ForTheRecord.FTR();
            f.ShowSchedules();

            return 0;
         }
      }

      public class ListPrograms : ConsoleCommand
      {
         public ListPrograms()
         {
            this.IsCommand("ListPrograms", "List ForTheRecord recording program names.");
            this.SkipsCommandSummaryBeforeRunning();
         }

         public override int Run(string[] remainingArguments)
         {
            ForTheRecord.FTR f = new ForTheRecord.FTR();
            f.ShowProgramTitles();

            return 0;
         }
      }

      public class ListRecordingsForProgram : ConsoleCommand
      {
         public bool shortFilename;

         public ListRecordingsForProgram()
         {
            this.IsCommand("ListRecordingsForProgram", "List ForTheRecord recording for a program name.");
            this.SkipsCommandSummaryBeforeRunning();
            Options = new OptionSet() { { "s|short", "Use short filenames", b => shortFilename = b != null } };
            HasAdditionalArguments(1, "<ProgramName>");
         }

         public override int Run(string[] remainingArguments)
         {
            ForTheRecord.FTR f = new ForTheRecord.FTR();
            f.ShowAllRecordingsForProgram(remainingArguments[0], shortFilename);

            return 0;
         }
      }
   }
}
